home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
decky.arc
/
DECKEY.LIS
next >
Wrap
File List
|
1989-06-15
|
16KB
|
307 lines
DECKeybd.doc June, 1989
Introduction:
I'm typing this on a DEC LK201 keyboard connected to an Atari 1040ST
through the midi port. Now I won't have to get a Mega to have a
decent, detachable, keyboard! Besides, this keyboard has a better
layout and ( IMHO ) feel than the one that comes with a Mega.
One of reason that I started using ST's was that its keyboard layout is
almost identical to a DEC keyboard. Since my microcomputers spend a lot
of time acting as terminals talking to VAX computer systems, the
compatible keyboard layout is very important to me. On the other hand,
I have always hated the feel of the ST keyboard. I think it is the
ST's worst feature. Now I have been able to keep the layout and get
much better feel in a detached keyboard.
LK201s keyboards are used on all current DEC products, including
terminals and workstations. Moreover, they were used on the DEC Rainbow
PC's and on the previous generation of DEC terminals. As a result,
they are fairly common at ham and computer fests. You could also get a
new one from DEC as a replacement part, albeit for too much money!
The obvious choice for an external ST keyboard would be an extended PC
keyboard. Its layout is fairly close to the ST's, and it is relative
cheap and very available. Unfortuately, its electrical interface is
quite incompatible with any of the Atari's ports. PC keyboard use with
the ST would require a complicated external interface adapter. I don't
know if anyone has done it, but I decided it wasn't worth the trouble.
On the other hand, the LK201 keyboard can be wired directly to either
the serial or midi ports.
LK201s conform to RS-423 standards at 4800 baud, 8 bits, no parity, one
stop bit. They send a single byte of code ( a scan code ) for most key
presses, only the shift and control keys send codes on both down and
up. When a key or keys is help down, a metronome ( repeat ) code is
sent at a fixed rate.
The ST keyboards use a serial interface at 7.8125 K baud. They send a
scan code when a key is depressed or released. The software require to
convert input from the DEC keyboard to that used by the ST is straight
forward.
If you are willing to use your serial port, no modifications to the ST
or keyboard are required. All it takes is a small, external, power
supply and a RJ11 ( modular phone plug ) to DB25 adapter. The
limitation when using the serial port is that you can't use the ST as a
terminal with the external keyboard. The midi port interface doesn't
have this limitation but it does require internal modifications to the
ST.
The power supply requirement is 200ma. at 12 V. The voltage is
regulated internally so it isn't very critical. A range from 10 V. to
15 V. seems OK, although you might have internal heat problems in the
keyboard at the upper end of that range. Suitable wall transformer type
supplies are available for less than $10. Since I'm not going to buy a
Mega ST, my ST's power supply will have to handle 4 megabytes of memory
in the near future. I didn't want to further load the ST's already
marginal power supply with the extra keyboard.
The midi port problem is that its baud rate is is hardwired into the
computer. Changing the midi port's baud rate to 4800 baud is
straightforward, but it should only be done by someone with good
soldering skills and PC ( that's Printed Circuit, not Personal
Computer! ) experience.
The modification uses one TTL IC, half a dozen short pieces of wire,
two solder connections to pins on existing IC's and one trace cut on
the top of the ST circuit board. It isn't even necessary to remove the
metal shield on a 1040 ST, because everything you need to get at is
located under the disk drive. Since this change will affect the
operation of the midi port, you may wish to mount a switch ( SPDT )
that selects either 4800 or the normal ( 31.25K )baud rate.
No external keyboard, unless it is simply an ST keyboard mounted in a
separate case, can replace the built in keyboard. STs need the
mouse, joystick, and clock functions of the original keyboard. An
external keyboard must simply work in parallel with the original
keyboard.
Software:
When you strike a key on the ST's keyboard, a scancode is sent from it
to a serial port on the main board. This causes the serial port to
generate an interrupt. The interrupt is serviced by a routine that:
1. Gets the scan code sent by the keyboard
2. Determines wether it is dealing with
regular keys, shift keys or the mouse
3. Performs the appropriate function.
As a result of a regular key press, the scancode and an ascii code
( looked up in a set of tables ) are placed in a queue. Shift codes
( right shift, left shift, control, caps lock, and alternate ) simply
cause a change the contents of a flag byte. The contents of this byte
determine which of three tables is used for looking up the scan code
and if control or ALT are used as modifiers.
An external keyboard must duplicate, as much as is possible, these
regular key and shift functions and not disrupt the other ( mouse,
clock, and joystick ) keyboard functions. Since the builtin keyboard
functions involve modification of data structures ( keyboard queue and
shift byte ) in memory, the external keyboard software can simply
modify the same data structures. If the keyboard software was not
interrupt driven with these intermediate data stuctures, it would be
much more dificult to add an external keyboard.
The serial port, the keyboard port, and the midi port all use similar
interfaces. This makes it easy to write an interrupt handler for the
serial or midi port that duplicate the services provide by keyboard
port interrupt handler. Most of the needed subroutines are already in
the ST's ROMs. The code needed to add a keyboard is quite small, about
700 bytes. I'm sending uuencoded sources and binaries to
comp.{sources|binaries}. atari.st.
Bugs/Differences from the ST keyboard:
Well this an 'alpha' release, so it probably has a few unintended
'features'! On the other hand, it is a small, simple, and straight
forward program. I have been using the midi version for several weeks
on a 1040 ST and a friend has been using the serial port version on a
520 ST for two weeks. We haven't found any problems.
I did have trouble when I tried using the external keyboard to replace
my mouse buttons. I had to eliminate that 'feature' since it regularly
crashed the ST! The serial version won't work with a screen blanker
that monitors the keyboard/midi interrupt vector since it doesn't use
that vector! The midi version works with idle 1.2, but it must be run
before idle is run.
I didn't put a lot of effort into handling the alt key because I very
rarely use it. On the LK201, the alt key says 'Compose Character' and,
because of the way I handled it, it only affects the next key pressed.
The only program I use that has a problem with alt is Uniterm.
Unfortunately I use Uniterm more than any other program ( thank you
Simon Poole! ). Uniterm doesn't use the normal alt flag, so I just do
the Uniterm alt stuff from my regular keyboard.
The LK201 keyboard is programmable, but I have not made any use of this
feature. The midi interface is only 'RS423 compatible' for input, so
extra hardware would be required there. The serial interface should be
able to talk to the keyboard, but I had no luck in my limited attempts
to do so. Since I am comfortable with the keyboards default settings,
I made my interface input only.
Now let's consider the keyboard remappings: There is only one shift
code, so there is no way to set only one of two shift bits. I don't
have any programs that distinguish between the the two shift keys,
but you may. It can't be done with the DEC keyboard. Another DEC
limitation, DEC keyboards don't have a backspace key or an escape
key in the main keypad. I 'fixed' both these problems.
Delete is the key where backspace was and shift-delete acts as
backspace. This works well when I use the ST as a terminal and with
emacs like editors. Since some ST programs use backspace as delete
left, I also put bac